package com.hj.security.ui;

import com.hj.security.R;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class SetupGuide3Activity extends Activity implements OnClickListener {

	private Button bt_guide_select;
	private Button bt_guide_next;
	private Button bt_guide_previous;
	private EditText et_guide_phoneNumber;
	private SharedPreferences sp;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.setup_guide3);
		bt_guide_select = (Button) findViewById(R.id.bt_guide_select);
		et_guide_phoneNumber = (EditText) findViewById(R.id.et_guide_phoneNumber);
		bt_guide_next = (Button) findViewById(R.id.bt_guide_next);
		bt_guide_previous = (Button) findViewById(R.id.bt_guide_previous);
		sp = getSharedPreferences("config", MODE_PRIVATE);

		bt_guide_next.setOnClickListener(this);
		bt_guide_previous.setOnClickListener(this);
		bt_guide_select.setOnClickListener(this);

	}

	@Override
	public void onClick(View v) {
		Intent intent;
		switch (v.getId()) {
		case R.id.bt_guide_select:
			intent = new Intent(this, SelectContactActivity.class);
			startActivityForResult(intent, 0);
			intent = null;
			break;
		case R.id.bt_guide_next:
			intent = new Intent(this, SetupGuide4Activity.class);
			finish();
			startActivity(intent);
			intent = null;
			overridePendingTransition(R.anim.alpha_in, R.anim.alpha_out);  
			break;
		case R.id.bt_guide_previous:
			intent = new Intent(this, SetupGuide2Activity.class);
			finish();
			startActivity(intent);
			intent = null;
			overridePendingTransition(R.anim.alpha_in, R.anim.alpha_out); 
			break;

		default:
			break;
		}
	}
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		String name = data.getStringExtra("name");
		String phone = data.getStringExtra("phone");
		et_guide_phoneNumber.setText(phone);
		super.onActivityResult(requestCode, resultCode, data);
	}
}
